﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using HiStaff.Domain.Sys;
using HiStaff.Dal;
using System.Data;

namespace HiStaff.Service
{
    public partial class Common : ICommon
    {
        public DataTable ExcuteStoreToDataTable(string packname, string procname, DataTable parameter)
        {
            if (parameter != null && parameter.Rows.Count > 0)
                return OracleHelper.ExcuteSelectDataTable(packname, procname, parameter.Rows[0]);
            else
                return OracleHelper.ExcuteSelectDataTable(packname, procname);
        }
        public DataSet ExcuteStoreToDataSet(string packname, string procname, DataTable parameter)
        {
            if (parameter != null && parameter.Rows.Count > 0)
                return OracleHelper.ExcuteSelectDataSet(packname, procname, parameter.Rows[0]);
            else return OracleHelper.ExcuteSelectDataSet(packname, procname);
        }
        public bool ExcuteStoreNonQuery(string packname, string procname, DataTable parameter)
        {
            try
            {
                foreach (var drow in parameter.Rows)
                {
                    OracleHelper.ExcuteNonQuery(packname, procname, drow);
                }
                return true;
            }
            catch
            {
                return false;
            }
        }
    }
}
